package net.xiduth.game.npc.others;
 
import java.util.ArrayList;
import java.util.List;

import net.xiduth.game.Entity;
import net.xiduth.game.Graphics;
import net.xiduth.game.World;
import net.xiduth.game.WorldTile;
import net.xiduth.game.npc.NPC;
import net.xiduth.game.player.Player;
 
@SuppressWarnings("serial")
public class DeathNPC extends NPC {
 
 
    public DeathNPC(int id, WorldTile tile) {
        super(id, tile, -1, true, true);
        setForceMultiArea(true);
        setNoDistanceCheck(true);
    }
     
    @Override
    public void sendDeath(Entity source) {
        setNextGraphics(new Graphics(2924 + getSize()));
        super.sendDeath(source);
    }
 
    @Override
    public ArrayList<Entity> getPossibleTargets() {
        ArrayList<Entity> possibleTarget = new ArrayList<Entity>(1);
        List<Integer> playerIndexes = World.getRegion(getRegionId()).getPlayerIndexes();
        if(playerIndexes != null) {
            for (int npcIndex : playerIndexes) {
                Player player = World.getPlayers().get(npcIndex);
                if (player == null
                        || player.isDead()
                        || player.hasFinished()
                        || !player.isRunning())
                    continue;
                possibleTarget.add(player);
            }
        }
        return possibleTarget;
    }
 
}